package one.three.web.seven;

public class Fifth {

	public static void fifth(Stack<String> s) {
		Queue<String> q = new Queue<String>();
		String t;
		for (int i = 0; i < 5; i++) {
			t = s.pop();
			q.enqueue(t);
		}
		while (!s.isEmpty()) {
			t = s.pop();
			q.dequeue();
			q.enqueue(t);
		}
		while(!q.isEmpty()) {
			System.out.println(q.dequeue());
		}
		//System.out.println(q);
	}

	public static void main(String[] args) {
		Stack<String> s = new Stack<String>();
		for (int i = 0; i < 10; i++) {
			s.push(i + "");
		}
		
		fifth(s);
	}

}
